import React, {Component} from 'react';

import {connect} from 'react-redux';
import {setUser} from '../../redux/actions/user';

class Login extends Component {

	login = () => {
		const user = {
			token: 'a5a4sd65f13s61df'
		}
		sessionStorage.setItem('user', JSON.stringify(user))
		this.props.setUser(user)
		this.props.history.push('/home')
	}
	render() {
		return (
			<button onClick={this.login}>点我登录</button>
		);
	}
}

export default connect(
	state => ({
		user: state.user
	}),
	{setUser}
)(Login)
